<!--
  ~ The MIT License (MIT)
  ~
  ~ Copyright (c) 2019 ‭‭‭‭‭‭‭‭‭‭‭‭[smallbun] www.smallbun.org
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy of
  ~ this software and associated documentation files (the "Software"), to deal in
  ~ the Software without restriction, including without limitation the rights to
  ~ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  ~ the Software, and to permit persons to whom the Software is furnished to do so,
  ~ subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  ~ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  ~ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  ~ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  ~ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  -->

<!DOCTYPE HTML>
<!--suppress ALL-->
<html lang="zh-cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <div th:include="fragments/include :: header('添加用户')"></div>
    <div th:include="fragments/include :: ztree-css"></div>
</head>
<body>
<div class="i-ibox">
    <div class="ibox-content">
        <form id="inputForm" class="form-horizontal" th:action="@{/user/saveOrUpdate}" method="post"
              th:object="${user}">
            <input id="id" name="id" type="hidden" th:field="*{id}">
            <h4 class="page-header h4">基本信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">
                            <span style="color: red; ">*</span>归属部门：</label>
                        <div class="col-sm-8">
                            <div class="input-group" style="width: 100%">
                                <input readonly="readonly" type="text" id="pop-up-org-tree" placeholder="请选择归属部门"
                                       class="form-control" th:value="*{orgId}" required/>
                                <span class="input-group-addon"><i class="fa fa-search"></i></span>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>姓名：</label>
                        <div class="col-sm-8">
                            <input th:field="*{fullName}" autocomplete="off" placeholder="请输入姓名"
                                   class="form-control required" type="text"
                                   maxlength="30"
                                   aria-required="true">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>工号：</label>
                        <div class="col-sm-8">
                            <input th:field="*{jobNumber}" placeholder="请输入工号" autocomplete="off"
                                   class="form-control" request type="text" maxlength="10">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">电话：</label>
                        <div class="col-sm-8">
                            <input th:field="*{telephone}" autocomplete="off" placeholder="请输入电话号码" class="form-control"
                                   type="text"
                                   maxlength="50">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">出生日期：</label>
                        <div class="col-sm-8">
                            <input th:field="*{birthday}" autocomplete="off" placeholder="请选择出生日期" class="form-control"
                                   type="text"
                                   maxlength="50">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">邮箱：</label>
                        <div class="col-sm-8">
                            <input th:field="*{email}" autocomplete="off" class="form-control email" type="text"
                                   maxlength="50"
                                   data-inputmask="'alias':'email'" placeholder="请输入邮箱" data-mask>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">身份证号：</label>
                        <div class="col-sm-8">
                            <input th:field="*{idCard}" autocomplete="off" class="form-control" type="text"
                                   maxlength="18" placeholder="请输入身份证号">
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="page-header h4">账号信息</h4>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>登录名：</label>
                        <div class="col-sm-8">
                            <input th:field="*{username}" placeholder="请输入用户名" autocomplete="off"
                                   class="form-control required" type="text"
                                   maxlength="30">
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">手机号：</label>
                        <div class="col-sm-8">
                            <input th:field="*{phone}" placeholder="请输入手机号" autocomplete="off"
                                   class="form-control"
                                   type="text">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>用户类型：</label>
                        <div class="col-sm-8">
                            <div class="input-group" style="width: 100%">
                                <select class="form-control select2 required" th:field="*{userType}"
                                        th:with="type=${@smallbun.dict('USER_TYPE')}">
                                    <option value="">请选择用户类型</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label"><span style="color: red; ">*</span>用户状态：</label>
                        <div class="col-sm-8">
                            <div class="input-group" style="width: 100%">
                                <select class="form-control select2 required" th:field="*{userStatus}"
                                        th:with="type=${@smallbun.dict('USER_STATUS')}">
                                    <option value="">请选择用户状态</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                            th:value="${dict.dictValue}">
                                    </option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="page-header h4">角色权限</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">用户角色：</label>
                        <div class="col-sm-10">
                            <div class="input-group" style="width: 100%">
                                <label class="label-radio" required
                                       th:each="role : *{@smallbun.roles(roleList)}">
                                    <input type="checkbox" class="minimal"
                                           th:value="${role.id}" id="roleList" th:checked="${role.flag}" required>
                                    <label th:text="${role.roleName}"></label>
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="page-header h4">其他信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">备注：</label>
                        <div class="col-xs-10">
                            <textarea th:field="*{remarks}" autocomplete="off" maxlength="200" class="form-control "
                                      rows="3"></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <div class="box-footer">
        <div class="row">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-sm ibtn-primary" onclick="doSubmit()" id="btn-submit">
                    <i class="fa fa-check"></i>
                    保 存
                </button>&nbsp;
                <button type="button" class="btn btn-sm btn-default" id="btn-cancel"
                        onclick="parent.closeCurrentTabPage(window)">
                    <i class="fa fa-reply-all"></i>
                    关 闭
                </button>
            </div>
        </div>
    </div>
</div>
</body>
<div th:include="fragments/include :: include-js"></div>
<div th:include="fragments/include :: ztree-js"></div>
<div th:include="fragments/include :: jquery-validate-js"/>
<div th:include="fragments/include :: laydate-js"/>
<div th:include="fragments/include :: inputmask-js"></div>
<script th:src="@{/static/modules/manage/js/user/user_form.js}"></script>
</html>